package com.tedu.oop.day3;
/*继承 extends
    1.单继承
    2.私有资源不能继承
    3. Cat is a Animal
 */
public class Test1_Extends_Animal {
    public static void main(String[] args) {
        Animal a=new Animal();//实例化父类
        a.eat();

        Cat c=new Cat();//实例化子类
        c.eat();

        MachineCat m=new MachineCat();//实例化子子类
        m.eat();
        m.age=500;
        System.out.println("叮当猫"+m.age+'岁');

    }
}
class Animal{
    int age;

    public void eat(){
        System.out.println("吃！！！");
    }

}

class Cat extends Animal{

    @Override
    public void eat(){//重写父类Animal  eat()方法
        System.out.println("猫吃鱼！！！");
    }

}

class MachineCat extends Cat{

    @Override
    public void eat(){////重写父类Cat  eat()方法
        System.out.println("叮当猫吃铜锣烧！！！");
    }


}
